from typing import List
def isValidSudoku(board: List[List[str]]) -> bool:
    """ c = [[[] for i in range(9)] for _ in range(3)]
    for i,row in enumerate(board):
        for j, val in enumerate(row):
            if val == ".": continue
            for p,k in [[0,i],[1,j],[2,3*(i//3)+j//3]]:
                if val in c[p][k]: return False
                else: c[p][k].append(val)

    return True """
    c = [[[] for i in range(9)] for _ in range(3)]
    for i, row in enumerate(board):
        for j, val in enumerate(row):
            if val == ".":continue
            for p,v in [[0, i], [1, j], [2, 3*(i//3) + j//3]]:
                if val in c[p][v]:return False
                else: c[p][v].append(val)
    return True

isValidSudoku([["5","3",".",".","7",".",".",".","."],["6",".",".","1","9","5",".",".","."],[".","9","8",".",".",".",".","6","."],["8",".",".",".","6",".",".",".","3"],["4",".",".","8",".","3",".",".","1"],["7",".",".",".","2",".",".",".","6"],[".","6",".",".",".",".","2","8","."],[".",".",".","4","1","9",".",".","5"],[".",".",".",".","8",".",".","7","9"]])